import 'package:flutter/material.dart';

import '../../config/public_color.dart';
import '../../foundation/decoration/border_decoration.dart';
import '../../foundation/style/bold_text_style.dart';
import '../container/radius_container.dart';

/// FileName border_tag
///
/// @Author lax
/// @Date 2024/3/14
///
/// @Description

class BorderTag extends StatelessWidget {
  final String? text;

  late final TextStyle? style;

  final double? radius;

  final EdgeInsets? margin;
  final EdgeInsets? padding;

  final Color? borderColor;

  BorderTag({
    super.key,
    this.text,
    TextStyle? style,
    this.radius = 3,
    this.margin,
    this.padding = const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
    this.borderColor,
  }) {
    this.style =
        style ?? BoldTextStyle(fontSize: 12, color: PublicColor.primary);
  }

  @override
  Widget build(BuildContext context) {
    if (text == null) {
      return const SizedBox();
    }
    return RadiusContainer(
      margin: margin,
      padding: padding,
      decoration: BorderDecoration(
        radius: radius,
        borderColor: borderColor ?? style?.color,
      ),
      child: Text(text ?? '', style: style),
    );
  }
}
